<?php

namespace app\admin\model;

use think\Model;
use think\model\concern\SoftDelete;

class AppLog extends Model
{
    public static function getList()
    {
        $list = self::select()->toArray();
        foreach ($list as $k => $v) {
            $list[$k]['content'] = self::formatUpdateContent($list[$k]['content']);
        }
        return $list;
    }
    private static function formatUpdateContent($content)
    {
        // 按换行符分割内容
        $lines = explode("\n", $content);

        // 为每行添加 > 符号
        $formattedLines = array_map(function ($line) {
            return "<li>" . $line . "</li>";
        }, $lines);

        // 重新组合内容
        return implode("<li>", $formattedLines);
    }
}
